package v1

import (
	"gen-code-v2/internal/model"
	"gen-code-v2/internal/model/entity"
	"github.com/gogf/gf/v2/frame/g"
)

type DBPageListReq struct {
	g.Meta `path:"/pageList" tags:"Database" method:"post" summary:"分页获取数据源列表"`
	model.PageReq
	Group string `json:"group" dc:"分组名称"`
	Name  string `json:"name" dc:"数据库名称"`
}

type DBListReq struct {
	g.Meta `path:"/list" tags:"Database" method:"post" summary:"获取数据源列表"`
	Group  string `json:"group" dc:"分组名称"`
	Name   string `json:"name" dc:"数据库名称"`
}

type DBPageListRes struct {
	Total int                   `json:"total" dc:"总数"`
	Rows  []*entity.GenDatabase `json:"rows" dc:"数据"`
}

type DBListRes struct {
	Rows []*entity.GenDatabase `json:"rows" dc:"数据"`
}

type DBAddReq struct {
	g.Meta `path:"/add" tags:"Database" method:"post" summary:"添加数据源"`
	Group  string `json:"group" v:"required#分组名称不能为空" dc:"分组名称"`
	Host   string `json:"host" v:"required#地址不能为空" dc:"地址"`
	Port   string `json:"port" v:"required#端口不能为空" dc:"端口"`
	User   string `json:"user" v:"required#账号不能为空" dc:"账号"`
	Pass   string `json:"pass" v:"required#密码不能为空" dc:"密码"`
	Name   string `json:"name" v:"required#请填写数据库名称" dc:"数据库名称"`
	Type   string `json:"type" d:"mysql" dc:"数据库类型"`
	Remark string `json:"remark" dc:"备注"`
}

type DBDelReq struct {
	g.Meta `path:"/" tags:"Database" method:"delete" summary:"删除数据源"`
	Ids    []int `json:"ids" v:"required#请选择需要删除的数据" dc:"id集合"`
}
